﻿//-----------------------------------------------------------------------
// <copyright file="NavigationArea.cs" company="deixei.com">
//     Copyright (c) deixei.com. All rights reserved.
// </copyright>
// <author>Marcio Parente</author>
//---------------------------------------------------------------------
namespace Deixei.Domain
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Web.Script.Serialization;

    /// <summary>
    /// Navigation Area, Main menu options.
    /// </summary>
    public class NavigationArea : IDomainEntity, IArchivable, IAuditable
    {
        /// <summary>
        /// Gets or sets the id.
        /// </summary>
        /// <value>
        /// The id.
        /// </value>
        [Key]
        [Display(Name = "Id")]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        /// <summary>
        /// Gets or sets the name of the group.
        /// </summary>
        /// <value>
        /// The name of the group.
        /// </value>
        [Required(ErrorMessage= "Group name is required.")]
        [Display(Name = "Group name", Description = "Areas are divided in Groups, this is that name.")]
        public string GroupName { get; set; }

        /// <summary>
        /// Gets or sets the area.
        /// </summary>
        /// <value>
        /// The area.
        /// </value>
        [Required(ErrorMessage = "Area name is required.")]
        [Display(Name = "Area name", Description = "Area name is the internal area name. ", ShortName="Area")]
        public string Area { get; set; }

        /// <summary>
        /// Gets or sets the description.
        /// </summary>
        /// <value>
        /// The description.
        /// </value>
        [Display(Name = "Description", Description = "This text will be displayed to the user. ", ShortName = "Description")]
        public string Description { get; set; }

        /// <summary>
        /// Gets or sets the URL.
        /// </summary>
        /// <value>
        /// The URL.
        /// </value>
        [DataType(DataType.Url)]
        [Display(Name = "Url", Description = "Link to this area default action. Represents the action when Area option is selected.", ShortName = "Url")]
        public string Url { get; set; }

        /// <summary>
        /// Gets or sets the controllers.
        /// </summary>
        /// <value>
        /// The controllers.
        /// </value>
        [ScriptIgnore]
        [Display(Name = "Navigation Controllers", Description = "List of Navigation Controllers for this area. Sub Menu options", ShortName = "Controllers")]
        public virtual ICollection<NavigationController> Controllers { get; set; }

        /// <summary>
        /// Gets or sets the web app portfolio.
        /// </summary>
        /// <value>
        /// The web app portfolio.
        /// </value>
        [ScriptIgnore]
        [Display(Name = "Web App Portfolio", Description = "Web Application Portfolio.", ShortName = "Web App")]
        public virtual WebAppPortfolio WebAppPortfolio { get; set; }

        /// <summary>
        /// Archivable Region
        /// </summary>
        /// <value>
        /// The deleted by.
        /// </value>
        [Display(Name = "Deleted By", Description = "Username of the user that deleted this item.", ShortName = "Del.By")]
        public string DeletedBy { get; set; }

        /// <summary>
        /// Gets or sets the deleted.
        /// </summary>
        /// <value>
        /// The deleted.
        /// </value>
        [DataType(DataType.DateTime)]
        [Display(Name = "Deleted Date", Description = "Date of when this item was deleted.", ShortName = "Del.Dt")]
        public DateTime? Deleted { get; set; }

        /// <summary>
        /// Auditable Region
        /// </summary>
        /// <value>
        /// The created by.
        /// </value>
        [Display(Name = "Created By", Description = "Username of the user that firts registered this item.", ShortName = "Crt.By")]
        public string CreatedBy { get; set; }

        /// <summary>
        /// Gets or sets the created.
        /// </summary>
        /// <value>
        /// The created.
        /// </value>
        [DataType(DataType.DateTime)]
        [Display(Name = "Created Date", Description = "Date of when this item was firts registered.", ShortName = "Crt.Dt")]
        public DateTime Created { get; set; }

        /// <summary>
        /// Gets or sets the updated by.
        /// </summary>
        /// <value>
        /// The updated by.
        /// </value>
        [Display(Name = "Updated By", Description = "Username of the user that last changed this item.", ShortName = "Upd.By")]
        public string UpdatedBy { get; set; }

        /// <summary>
        /// Gets or sets the updated.
        /// </summary>
        /// <value>
        /// The updated.
        /// </value>
        [DataType(DataType.DateTime)]
        [Display(Name = "Updated Date", Description = "Date of when this item was last changed.", ShortName = "Upd.Dt")]
        public DateTime? Updated { get; set; }
    }
}
